package com.mornd.gulimall.ware.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import com.mornd.gulimall.common.core.entity.PageEntity;
import com.mornd.gulimall.common.core.validation.UpdateGroup;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * <p>
 * 采购单
 * </p>
 *
 * @author mornd
 * @since 2023-07-29
 */
@Getter
@Setter
@TableName("wms_purchase")
public class Purchase extends PageEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @NotNull(groups = UpdateGroup.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 采购人id
     */
    @NotNull
    private String assigneeId;

    /**
     * 采购人姓名
     */
    @NotBlank
    private String assigneeName;

    /**
     * 联系方式
     */
    @Size(min = 0, max = 11)
    private String phone;

    /**
     * 优先级
     */
    @Min(0)
    @NotNull
    private Integer priority;

    /**
     * 状态[0：新建 1：已分配 2：已领取 3：已完成 4：有异常]
     */
    @NotNull
    @Range(min = 0, max = 4)
    private Integer status;

    /**
     * 仓库id
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Long wareId;

    /**
     * 总金额
     */
    @Min(0)
    private BigDecimal amount;

    /**
     * 创建日期
     */
    private LocalDateTime createTime;

    /**
     * 更新日期
     */
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private String key;


    @TableField(exist = false)
    private String wareName;

}
